<template>
  <div class="change-page">
    <headBar  isBack="show">
      <div slot="xm-header-center">
        <div class="xm-header-title" >换货管理</div>
      </div>
      <div slot="xm-header-right">
        <router-link to="/change/apply">我要换货</router-link>
      </div>
    </headBar>
    <!--<div class="tit flex flex-pack-justify"><span>换货列表</span><span>{{addressList.length}}条记录</span></div>-->
    <dl class="change-list">
      <dd v-for="item in addressList">
        <div class="content">
          <div class="flex addr">
            <span>地址：</span>
            <p>{{item.addressName}}</p>
          </div>
          <div class="flex p1 flex-pack-justify">
            <div  class="f2"><span>时间：</span>{{item.createTime}}</div>
            <div><span class="f2">{{item.status | statusName}}</span></div>
          </div>
          <div class="flex p1 border-bottom">
            <span class="f2">换货原因：</span>
            <p>{{item.addressName}}</p>
          </div>
          <div class="flex p1">
            <span class="f2">换货说明：</span>
            <p>{{item.description}}</p>
          </div>
          <div class="flex p1 border-top" :class="{'hide': !item.unpassReason}">
            <span class="f2">换货结果：</span>
            <p>{{item.unpassReason}}</p>
          </div>
        </div>
      </dd>
    </dl>
  </div>
</template>
<script>
  export default {
    props: {},
    data() {
      return {
        addressList: []
      };
    },
    methods: {
      //获取收货地址列表
      getChange(){
        changeGoodsList().then(data=>{
          if(data.returnCode == '000000'){
            this.addressList = data.result.exchangeList;
          }
        })
      },

    },
    filters: {
        statusName(status){
          if(status == 1){
            return '换货中';
          } else if(status == 2) {
            return '同意换货';
          } else if(status == 3){
            return '不同意换货';
          }
          return '未知状态';
        },
        typeName(type){
            if(type == 1){
              return '质量问题';
            }
        }
    },
    created() {
      this.getChange();
    },
    mounted(){

    },
    components: {
    }
  };
</script>
<style lang="less">
  @import "./change.less";
</style>
